package com.ujson.uaa.persistence;

import com.ujson.base.persistence.BaseDo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.persistence.*;
import java.util.List;

@Data
@ApiModel("用户表")
@Entity
@Table(name = "t_user")
public class UserDo extends BaseDo {

    @ApiModelProperty("密码")
    @Column(name = "password", length = 60)
    private String password;

    @ApiModelProperty("手机号")
    @Column(name = "phone", length = 15)
    private String phone;

    @ApiModelProperty("邮箱")
    @Column(name = "email", length = 100)
    private String email;

    @ApiModelProperty("用户关联的角色")
    @ManyToMany()
    @JoinTable(name = "t_user_role", joinColumns = @JoinColumn(name = "u_id"), inverseJoinColumns = @JoinColumn(name = "r_id"))
    private List<RoleDo> roles;
}
